var app = getApp();

Page({
    data: {
        submitbtn: !0,
        state: "",
        f_id: "",
        over: !1,
        openid: "",
        b_id: "",
        b_mid: ""
    },
    getMoney: function(t) {
        var e = this, i = t.detail.value.money, n = (e.data.openid, wx.getStorageSync("openid"), 
        t.detail.value.b_id), o = t.detail.value.b_mid;
        e.setData({
            submitbtn: !1
        }), app.util.request({
            url: "entry/wxapp/Shangjiainfo",
            data: {
                openid: wx.getStorageSync("openid")
            },
            success: function(a) {
                app.util.request({
                    url: "entry/wxapp/Yongjin",
                    data: {
                        money: i,
                        b_id: n,
                        b_mid: o
                    },
                    success: function(t) {
                        console.log(t.data.data);
                        // i为这一单卖家输入的佣金  s_money为商家总余额 t.data.data为分销奖金(已删)
                        // n为openid
                        app.util.request({
                            url: "entry/wxapp/Jiesuan",
                            data: {
                                money: i,
                                b_id: n,
                                b_mid: o
                            },
                            success: function(t) {
                                wx.showToast({
                                    title: "结算成功"
                                }), setTimeout(function() {
                                    wx.navigateTo({
                                        url: "/hyb_jianzhi/shop_apply_detail/shop_apply_detail?f_id=" + e.data.f_id + "&state=" + e.data.state
                                    });
                                }, 1e3);
                            }
                        });
                    }
                });
            }
        });
    },
    onLoad: function(t) {
        var a = this, e = t.f_id, i = t.state;
        a.setData({
            state: i,
            f_id: e
        }), a.getBase(), a.getBaomingxq(e, i);
    },
    getBase: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/Base",
            success: function(t) {
                a.setData({
                    base: t.data.data
                });
            }
        });
    },
    payMoney: function(t) {
      // 下方：  * this.data.base.jiesuan
        var a = t.detail.value;
        // a = a.toFixed(2);
        // console.log(a);
        this.setData({
            values: t.detail.value,
            pay: a
        });
    },
    getBaomingxq: function(t, a) {
        var e = this;
        app.util.request({
            url: "entry/wxapp/Baomingxq",
            data: {
                state: a,
                f_id: t
            },
            success: function(t) {
                console.log(t.data.data), e.setData({
                    list: t.data.data
                });
            }
        });
    },
    previewClick: function(t) {
        var a = t.currentTarget.dataset.b_openid, e = t.currentTarget.dataset.f_id, i = t.currentTarget.dataset.b_id;
        wx.navigateTo({
            url: "/hyb_jianzhi/preview/preview?b_openid=" + a + "&f_id=" + e + "&b_id=" + i
        });
    },
    // 录用
    Luyong: function(t) {
        var a = this;
        var e = t.currentTarget.dataset.b_id;
        app.util.request({
            url: "entry/wxapp/Luyong",
            data: {
                b_id: e
            }
        });
    },
    callPhone: function(t) {
        wx.makePhoneCall({
            phoneNumber: t.currentTarget.dataset.phone
        });
    },
    // 确认到岗
    daogang: function(t) {
        var a = this, e = t.currentTarget.dataset.b_id;
        app.util.request({
            url: "entry/wxapp/Daogang",
            data: {
                b_id: e
            },
            success: function(t) {
                a.getBaomingxq(a.data.f_id, a.data.state);
            }
        });
    },
    jiesuan: function(t) {
        this.setData({
            over: !0,
            openid: t.currentTarget.dataset.openid,
            b_id: t.currentTarget.dataset.b_id,
            b_mid: t.currentTarget.dataset.b_mid
        });
    },
    hideClick: function() {
        this.setData({
            over: !1
        });
    },
    remove: function(t) {},
    onReady: function() {},
    onShow: function() {
        this.setData({
            over: !1,
            submitbtn: !0
        }), this.getBaomingxq(this.data.f_id, this.data.state);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});